#include "level.h"
#include <string>
#include <chrono>
#include <thread>
#include <sstream>
using std::string;
using std::vector;

Level::Level(int a, int b, QWidget* c, QWidget* g, QRect rec, bool killed):Chapter(a), Chapterlevel(b), ChapterParent(c), GameBaseParent(g){
    this->setParent(c);
    this->setGeometry(rec);

    std::stringstream lst;
    string lstr;
    lst << a << "-" << b;
    lst >> lstr;
    this->setTitle(QString(lstr.c_str()));

    WinImage = new QWidget;
    WinImage->setParent(this);
    WinImage->setGeometry(0, 20, 30, 30);
    StartButton = new QPushButton;
    StartButton->setParent(this);
    StartButton->setGeometry(30, 20, 100, 30);
    killedOrNot = killed;
    if (killed){
        StartButton->setText("Retry");
        WinImage->setStyleSheet("image: url(:/new/Pictures/yet.jpeg);");
    }
    else{
        StartButton->setText("Start!");
        WinImage->setStyleSheet("image: url(:/new/Pictures/already.jpeg);");
    }

    /*
    Game* Engineptr = new Game(GameBaseParent);
    Engineptr->setGeometry(0, 0, 800, 600);
    Engineptr->setStyleSheet("background-color: rgb(249, 240, 107);");
    */
}

/*
void Level::StartGame(){
    GameBaseParent->show();
    ChapterParent->hide();
}*/

Level::~Level(){
    delete WinImage;
    delete StartButton;
    /*
    if (Engineptr != nullptr)
        delete Engineptr;
    qDebug() << "Destroyed";
    */
}
